package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Accident;


public class AccidentDao extends IbatisDao{
	
	public List selectAccident() throws SQLException {
		List selectAccident = null;
			selectAccident =getSqlMap().queryForList("SELECT_ALL_ACCIDENT", null);
		return selectAccident;
	}

	public int deleteAccident(Accident accident) throws SQLException{
		return (int) getSqlMap().delete("DELETE_ACCIDENT", accident);
	}
	
	public int updateAccident(Accident accident) throws SQLException{
		return (int) getSqlMap().update("UPDATE_ACCIDENT", accident);
	}
	
	public Accident insertAccident(Accident accident) throws SQLException{
		return (Accident) getSqlMap().insert("INSERT_ACCIDENT", accident);
	}

	public Accident insertAccidentType(Accident accident) throws SQLException {
		return (Accident) getSqlMap().insert("INSERT_ACCIDENT_TYPE",accident);
	}
	
		public List selectAccidentType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_ACCIDENT_TYPE", null);
	}
	
		
	public static void main (String args[]) throws SQLException{
		Accident accident;
		accident = new Accident();
		accident.setAddress("kota nan sedjahtera");
		new AccidentDao().insertAccident(accident);
		}
	
}

